<template>
	<view class="team">
		<view class="flex-between" style="margin-bottom: 30rpx;">
			<view class="bold">选择赛事队伍</view>
			<view style="color: #2F75FA;" @click="add" v-if="list.length">添加</view>
		</view>

		<!-- <u-checkbox-group v-model="checked" shape="circle" v-if="list.length">
			<view class="list" style="width: 100%;">
				<team-info-item
					v-for="item in list"
					:key="item.id"
					:data="item"
				>
					<template #right>
						<u-checkbox :name="item.id" />
					</template>
				</team-info-item>
			</view>
		</u-checkbox-group>
		<view v-else @click="add" >
			<u-empty :icon="`${assetsPath}15ee183896ac4578c2c37c556b178a1ad00fec6a.png`" text="请添加队员或队伍>" textColor="#2F75FA" marginTop="80rpx"></u-empty>
		</view> -->



		<u-radio-group v-model="checked" shape="circle" v-if="list.length" @change="groupChange">
			<view class="list" style="width: 100%;">
				<team-info-item v-for="item in list" :key="item.id" :data="item">
					<template #right>
						<u-radio :name="item.id" @change="radioChange(item)" />
					</template>
				</team-info-item>
			</view>
		</u-radio-group>
		<view v-else @click="add">
			<u-empty :icon="`${assetsPath}15ee183896ac4578c2c37c556b178a1ad00fec6a.png`" text="请添加队员或队伍>"
				textColor="#2F75FA" marginTop="80rpx"></u-empty>
		</view>
	</view>
</template>

<script>
	import {
		getCurrentPath
	} from '@/utils/util.js';

	export default {
		props: {
			list: {
				type: Array,
				default: () => []
			}
			// value: {
			// 	type: Array,
			// 	default: () => []
			// }
		},
		data() {
			return {
				assetsPath: this.$https.assetsPath,
			}
		},
		computed: {
			checked: {
				get() {
					return this.value;
				},
				set(val) {
					this.$emit('input', val);
				}
			}
		},
		methods: {
			groupChange(n) {
				console.log('groupChange', n);
			},
			radioChange(item) {
				console.log('radioChange', item);
			},
			add() {
				uni.navigateTo({
					// url: `/pages/personal/team-info/add/add?return=${getCurrentPath()}`
					// url: `/page_venues/pages/team-info/add/add?return=${getCurrentPath()}`
					url: '/page_venues/pages/team-info/add/add?type='+ 1
					
				});
			},
			addMember() {
				uni.navigateTo({
					url: 'pages/race/choose-member/add-member/add-member'
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.add-member {
		width: 72rpx;
		height: 72rpx;
		border: 1rpx dashed #999;
		border-radius: 50%;
	}
</style>
